package kr.co.skplanet.commute.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

//1) java.io.Serializable 를 구현한다.
//2) @Entity @Table 어노테이션을 사용한다.
@Entity
@Table(name = "GUESTBOOK2")
public class Guestbook  implements Serializable{

	private static final long serialVersionUID = 8544602138397688805L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	@Column(name = "name")
	private String name;
	@Column(name = "content")
	@Type(type="text")	
	private String content;
	@Column(name = "regdate")
	private Date regdate; // java.util.Date
	
	// 생성자가 있어야 한다.
	public Guestbook(){
		// 자동으로 입력되어야 할 값은 생성자에서 값을 넣어준다.
		setRegdate(new Date());
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getRegdate() {
		return regdate;
	}

	public void setRegdate(Date regdate) {
		this.regdate = regdate;
	}

	@Override
	public String toString() {
		return "Guestbook [id=" + id + ", name=" + name + ", content="
				+ content + ", regdate=" + regdate + "]";
	}
	
	
}
